﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="StudentForm.ascx.cs"
    Inherits="WEB.APP.Controls.List.StudentForm" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<ext:XScript ID="XScript1" runat="server">
    <script language="javascript" type="text/javascript">
        var RendererProjectType = function (value) {
            switch (value) {
                case 1:
                    return 'Database Design and Development';
                case 2:
                    return 'Software Development';
                case 3:
                    return 'Mobile Application';
                case 4:
                    return 'Web Application';
                case 5:
                    return 'Systems Analysis and Design';
                case 6:
                    return 'Website Design and Development';
                case 7:
                    return 'Systems Administration';
                case 8:
                    return 'Operating System Development';
                case 9:
                    return 'Web Systems development';
                default:
                    return value;
            }
        }
        var RendererProjectSize = function (value) {
            switch (value) {
                case 1:
                    return 'Easy';
                case 2:
                    return 'Medium complexity';
                case 3:
                    return 'Complex';
                default:
                    return value;
            }
        }
    </script>
</ext:XScript>

<ext:Window ID="winDetails" runat="server" Title="Student Detail" Frame="false" Hidden="true"
    CenterOnLoad="true" Width="600" BodyStyle="padding:5px 5px 0px 5px;" Resizable="false"
    Closable="true" Layout="FormLayout" AutoHeight="true" Icon="Group" IDMode="Inherit"
    Modal="true">
    <Items>
        <ext:DisplayField ID="DisplayField1" runat="server" Text="<span style='color: Red;'>*</span> is Required field" HideLabel="True" />
        <ext:FormPanel ID="FormPanel1" runat="server" Header="false" LabelWidth="100" Border="false"
            MonitorValid="true" BodyStyle="background-color:transparent;" Layout="ColumnLayout"
            Height="440" Split="true">
            <Items>
                <ext:Hidden ID="hfStudentId" runat="server" />
                <ext:Panel ID="pnlCl1" runat="server" ColumnWidth="0.5" BodyStyle="background-color:transparent;"
                    BodyBorder="True" Layout="FormLayout" Border="False" LabelWidth="100">
                    <Defaults>
                        <ext:Parameter Name="Anchor" Value="98%" />
                        <ext:Parameter Name="padding" Value="8 0 0 0" Mode="Value" />
                    </Defaults>
                    <Items>
                        <ext:FieldSet ID="FieldSet1" runat="server" Layout="FormLayout" Padding="8">
                            <Defaults>
                                <ext:Parameter Name="Anchor" Value="99%" />
                            </Defaults>
                            <Items>
                                <ext:NumberField runat="server" ID="nfStudentId" FieldLabel="Student Id<span style='color: Red;'>*</span>" MaxLength="10"
                                    AllowBlank="false">
                                </ext:NumberField>
                                <ext:ComboBox runat="server" ID="cboSex" FieldLabel="Sex<span style='color: Red;'>*</span>" SelectedIndex="-1" AllowBlank="false">
                                    <Items>
                                        <ext:ListItem Text="Male" Value="true" />
                                        <ext:ListItem Text="Female" Value="false" />
                                    </Items>
                                </ext:ComboBox>
                                <ext:DateField ID="dfBirthDt" FieldLabel="Birth Dt<span style='color: Red;'>*</span>" runat="server" Editable="true"
                                    AllowBlank="false">
                                </ext:DateField>
                                <ext:TextField ID="txtHomeLang" FieldLabel="Home Lang<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="30" AllowBlank="false">
                                </ext:TextField>
                                <ext:TextField ID="txtSurName" FieldLabel="Sur Name<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="50" AllowBlank="false">
                                </ext:TextField>
                                <ext:TextField ID="txtGivenName" FieldLabel="Given Name<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="50" AllowBlank="false">
                                </ext:TextField>
                                <ext:ComboBox ID="cbProject" runat="server" DisplayField="ProjectId" ValueField="ProjectId"
                                    TypeAhead="false" ItemSelector="tr.list-item" MinChars="1" Width="150" SelectOnFocus="true"
                                    TriggerAction="All" EnableKeyEvents="true" ListWidth="500" FieldLabel="Project Id">
                                    <Store>
                                        <ext:Store ID="stStudentSearch" runat="server" AutoLoad="true">
                                            <Proxy>
                                                <ext:HttpProxy Method="POST" Url="/Modules/List/Search.ashx" DisableCaching="true"
                                                    AutoDataBind="true" />
                                            </Proxy>
                                            <Reader>
                                                <ext:JsonReader Root="Search" TotalProperty="total" IDProperty="ProjectId">
                                                    <Fields>
                                                        <ext:RecordField Name="ProjectId" />
                                                        <ext:RecordField Name="ClientId" />
                                                        <ext:RecordField Name="ProjectName" />
                                                        <ext:RecordField Name="ProjectType">
                                                            <Convert Fn="RendererProjectType" />
                                                        </ext:RecordField>
                                                        <ext:RecordField Name="ProjectDesc" />
                                                        <ext:RecordField Name="ProjectYear" />
                                                        <ext:RecordField Name="ProjectSize">
                                                            <Convert Fn="RendererProjectSize" />
                                                        </ext:RecordField>
                                                        <ext:RecordField Name="OtherSkill" />
                                                    </Fields>
                                                </ext:JsonReader>
                                            </Reader>
                                            <BaseParams>
                                                <ext:Parameter Name="type" Value="ProjectSearch" Mode="Value" />
                                            </BaseParams>
                                        </ext:Store>
                                    </Store>
                                    <Template ID="Template1" runat="server">
                                        <Html>
                                            <tpl for=".">
                                                <tpl if="[xindex] == 1">
                                                    <table class="cbStates-list" width="100%">
                                                </tpl>
                                                <tr class="list-item">
                                                    <td width="40px" style="padding:3px 0px;">{ProjectId}</td>
                                                    <td width="40px" style="padding:3px 0px;">{ClientId}</td>
                                                    <td width="100px" style="padding:3px 0px;">{ProjectName}</td>
                                                    <td width="100px" style="padding:3px 0px;">{ProjectType}</td>
                                                    <td width="100px" style="padding:3px 0px;">{ProjectYear}</td>
                                                    <td width="100px" style="padding:3px 0px;">{ProjectSize}</td>
                                                    <td width="100px" style="padding:3px 0px;">{ProjectDesc}</td>
                                                </tr>
                                                <tpl if="[xcount-xindex]==0"> 
                                                    </table>
                                                </tpl>
                                            </tpl>
                                        </Html>
                                    </Template>
                                    <Triggers>
                                        <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                    </Triggers>
                                    <Listeners>
                                        <Select Handler="this.triggers[0].show();" />
                                        <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                        <TriggerClick Handler="if (index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                    </Listeners>
                                </ext:ComboBox>
                            </Items>
                        </ext:FieldSet>
                        <ext:FieldSet ID="FieldSet2" runat="server" Layout="FormLayout" Padding="8">
                            <Defaults>
                                <ext:Parameter Name="Anchor" Value="99%" />
                            </Defaults>
                            <Items>
                                <ext:ComboBox runat="server" ID="txtLocationId" FieldLabel="Location Cd<span style='color: Red;'>*</span>" SelectedIndex="-1" AllowBlank="false">
                                    <Items>
                                        <ext:ListItem Text="CAM" Value="CAM" />
                                        <ext:ListItem Text="PEN" Value="PEN" />
                                        <ext:ListItem Text="PAR" Value="PAR" />
                                    </Items>
                                </ext:ComboBox>
                                <ext:TextField ID="txtEmailAddr" FieldLabel="Email Addr<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="50" AllowBlank="false">
                                </ext:TextField>
                                <ext:TextField ID="txtAddr1" FieldLabel="Addr 1<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="200" AllowBlank="false">
                                </ext:TextField>
                                <ext:TextField ID="txtAddr2" FieldLabel="Addr 2" runat="server" EnableKeyEvents="true"
                                    MaxLength="200">
                                </ext:TextField>
                                <ext:TextField ID="txtAddr3" FieldLabel="Addr 3" runat="server" EnableKeyEvents="true"
                                    MaxLength="200">
                                </ext:TextField>
                                <ext:TextField ID="txtAddr4" FieldLabel="Addr 4" runat="server" EnableKeyEvents="true"
                                    MaxLength="200">
                                </ext:TextField>
                                <ext:TextField ID="txtAddr5" FieldLabel="Addr 5" runat="server" EnableKeyEvents="true"
                                    MaxLength="200">
                                </ext:TextField>
                            </Items>
                        </ext:FieldSet>
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel1" runat="server" ColumnWidth="0.5" BodyStyle="background-color:transparent;"
                    BodyBorder="True" Layout="FormLayout" Border="False" LabelWidth="105">
                    <Defaults>
                        <ext:Parameter Name="Anchor" Value="99%" />
                        <ext:Parameter Name="padding" Value="8 0 0 0" Mode="Value" />
                    </Defaults>
                    <Items>
                        <ext:FieldSet ID="FieldSet3" runat="server" Layout="FormLayout" Padding="8">
                            <Defaults>
                                <ext:Parameter Name="Anchor" Value="99%" />
                            </Defaults>
                            <Items>
                                <ext:NumberField ID="nfCourseId" FieldLabel="Course Id<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="4" AllowBlank="false">
                                </ext:NumberField>
                                <ext:TextField ID="txtCourseTitle" FieldLabel="Course Title<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="50" AllowBlank="false">
                                </ext:TextField>
                                <ext:NumberField ID="nfComYr" FieldLabel="Com Yr<span style='color: Red;'>*</span>" LabelWidth="50" runat="server"
                                    EnableKeyEvents="true" MaxLength="4" MinValue="1900" AllowBlank="false">
                                </ext:NumberField>
                                <ext:NumberField ID="nfUaiYr" FieldLabel="Uai Yr<span style='color: Red;'>*</span>" LabelWidth="50" runat="server"
                                    EnableKeyEvents="true" MaxLength="4" MinValue="1900" AllowBlank="false">
                                </ext:NumberField>
                                <ext:NumberField ID="nfUai" FieldLabel="Uai<span style='color: Red;'>*</span>" LabelWidth="30" runat="server" EnableKeyEvents="true"
                                    MaxLength="3" AllowBlank="false">
                                </ext:NumberField>
                                <ext:NumberField ID="nfGpa" FieldLabel="Gpa<span style='color: Red;'>*</span>" LabelWidth="30" runat="server" EnableKeyEvents="true"
                                    MaxLength="1" AllowBlank="false">
                                </ext:NumberField>
                                <ext:NumberField ID="nfCreditPass" FieldLabel="Credit Pass<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="3" AllowBlank="false">
                                </ext:NumberField>
                            </Items>
                        </ext:FieldSet>
                        <ext:FieldSet ID="FieldSet4" runat="server" Layout="FormLayout" Padding="8">
                            <Defaults>
                                <ext:Parameter Name="Anchor" Value="99%" />
                            </Defaults>
                            <Items>
                                <ext:TextField ID="txtHomePhone" FieldLabel="Home Phone" runat="server" EnableKeyEvents="true"
                                    MaxLength="20">
                                </ext:TextField>
                                <ext:TextField ID="txtWorkPhone" FieldLabel="Work Phone" runat="server" EnableKeyEvents="true"
                                    MaxLength="20">
                                </ext:TextField>
                                <ext:TextField ID="txtMobile" FieldLabel="Mobile" runat="server" EnableKeyEvents="true"
                                    MaxLength="20">
                                </ext:TextField>
                                <ext:NumberField ID="nfAustPostcode" FieldLabel="Aust Post code<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="4" AllowBlank="false">
                                </ext:NumberField>
                                <ext:TextField ID="txtCitizenship" FieldLabel="Citizenship<span style='color: Red;'>*</span>" runat="server" EnableKeyEvents="true"
                                    MaxLength="30" AllowBlank="false">
                                </ext:TextField>
                                <ext:TextField ID="txtCitizenshipStatus" FieldLabel="Citizenship Status<span style='color: Red;'>*</span>" runat="server"
                                    EnableKeyEvents="true" MaxLength="20" AllowBlank="false">
                                </ext:TextField>
                            </Items>
                        </ext:FieldSet>
                    </Items>
                </ext:Panel>
            </Items>
            <Listeners>
                <ClientValidation Handler="#{btnSave}.setDisabled(!valid);" />
            </Listeners>
        </ext:FormPanel>
    </Items>
    <Buttons>
        <ext:Button ID="btnNew" runat="server" Text="New" Icon="New">
            <DirectEvents>
                <Click OnEvent="btnNew_Click" />
            </DirectEvents>
        </ext:Button>
        <ext:Button ID="btnSave" runat="server" Text="Save" Icon="Disk">
            <DirectEvents>
                <Click OnEvent="btnSave_Click" />
            </DirectEvents>
        </ext:Button>
        <ext:Button ID="btnCancel" runat="server" Text="Cancel" Icon="Cancel">
            <Listeners>
                <Click Handler="#{winDetails}.hide();" />
            </Listeners>
        </ext:Button>
    </Buttons>
</ext:Window>
